From: Florian Müllner Date: Sun, 12 Jan 2025 12:32:39 +0000 (+0100) Subject: util: Stop special-casing trySpawnCommandLine() parse errors X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~177^2^2~1 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=f0317cd9248616eebbf8da52162ffa6fef9bd339;p=gnome-shell.git util: Stop special-casing trySpawnCommandLine() parse errors Unlike for plain JS Errors, the `message` property of GLib.Errors is read-only, so the intent to replace it with a nicer message triggers an Error itself. We could create a new GLib.Error with the changed message instead, but as it turns out, none of the parse errors contain the technical prefix we want to strip out, so we can simply drop the special-casing altogether. This is also consistent with `spawnCommandLine()`, which never had special treatment of parse errors. Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/8146 Part-of: (cherry picked from commit 67c5be9c5364cfe9ee2bd00b337582eb1527b939) --- diff --git a/js/misc/util.js b/js/misc/util.js index 0dbb97b2e..517ff5784 100644 --- a/js/misc/util.js +++ b/js/misc/util.js @@ -160,17 +160,7 @@ export function trySpawn(argv) { * fails, this will throw an error. */ export function trySpawnCommandLine(commandLine) { - let success_, argv; - - try { - [success_, argv] = GLib.shell_parse_argv(commandLine); - } catch (err) { - // Replace "Error invoking GLib.shell_parse_argv: " with - // something nicer - err.message = err.message.replace(/[^:]*: /, `${_('Could not parse command:')}\n`); - throw err; - } - + const [, argv] = GLib.shell_parse_argv(commandLine); trySpawn(argv); }